﻿namespace KingerRobot.MexicoSailunMDC.SpiService;

internal interface IWmsOutOrderMaster
{
    /// <summary>
    /// 获取出库单信息
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    POWmsOutOrderMaster GetOutOrderMasterById(long id);
    /// <summary>
    /// 添加出库订单主数据
    /// </summary>
    /// <param name="orderType">出库订单类型</param>
    /// <param name="directLoc">直运扫描仪</param>
    /// <param name="directDelivery">是否直运【1：是】</param>
    /// <param name="priority">优先权</param>
    /// <returns></returns>
    long AddOutOrderMaster(int orderType, long? directLoc = null, int directDelivery = 0, int priority = 12, string mesOrderNo = "");

    /// <summary>
    /// 修改完成方式（主数据和明细）
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    int UpdateOutOrderFinish(long id, int finishMode);

    /// <summary>
    /// 删除出库订单
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    int DeleteOutOderMaster(long? id);

    /// <summary>
    /// 备份出库订单
    /// </summary>
    /// <param name="wmsOutOrderMaster"></param>
    /// <returns></returns>
    int BakOutOderMaster(POWmsOutOrderMaster wmsOutOrderMaster);

    /// <summary>
    /// 出库单结束(数据备份、删除、添加明细)
    /// </summary>
    /// <param name="task"></param>
    /// <returns></returns>
    int OutOrderFinish(POWcsTask task);
    /// <summary>
    /// 出库单结束(数据备份、删除、添加明细)
    /// </summary>
    /// <param name="masterId"></param>
    /// <param name="summaryId"></param>
    /// <returns></returns>
    int OutOrderFinishByBakTask(long masterId, long summaryId);
    /// <summary>
    /// 重新请料
    /// </summary>
    /// <param name="masterId"></param>
    /// <returns></returns>
    int ReRequestMaterial(long masterId);

    /// <summary>
    /// 修改出库订单状态
    /// </summary>
    /// <param name="id"></param>
    /// <param name="status"></param>
    /// <returns></returns>
    int UpdateMasterStatus(long id, int status);

    /// <summary>
    /// 修改出库单优先级
    /// </summary>
    /// <param name="id"></param>
    /// <param name="priority"></param>
    /// <returns></returns>
    int UpdateMasterOrderPriority(long id, int priority);

    /// <summary>
    /// 定时备份并删除超时的订单主从表
    /// </summary>
    /// <param name="dateTime"></param>
    /// <returns></returns>
    int QuartzBakAndDeleteOutOrder(DateTime dateTime);
    int BakAndDeleteOutOrderMaster(POWmsOutOrderMaster pOWmsOutOrderMaster);

    int BakAndDeleteOutOrderByTask(POWcsTask task);
}
